package top.minuy.structure.linear.array;

import top.minuy.model.Student;
/**
 * @author Minuy
 * @time 11:47
 * @date 2021/8/21
 */
public class Test {
    public static void main(String[] args) {
        Array<Student> array = new Array<Student>();

        for (int i=0;i<11;i++){
            array.addLast(new Student().setName("艾AA").setScore(i).setId(i));
        }

        System.out.println(array.toString());

        array.add(4,new Student().setName("艾BB").setScore(66).setId(66));
        System.out.println(array.toString());

        array.addFirst(new Student().setName("艾CC").setScore(6).setId(6));
        array.addLast(new Student().setName("艾DD").setScore(1).setId(1));
        System.out.println(array.toString());

        int[] res = array.findAll(new Student().setName("艾AA").setScore(6).setId(6));
        for (int i:res) {
            System.out.print(i+" ");
        }
        System.out.println();

        int[] i = array.removeAllElement(new Student().setName("艾AA").setScore(6).setId(6));
        array.removeFirst();
        array.removeFirst();
        array.removeFirst();
        array.removeFirst();
        array.removeFirst();
        array.removeFirst();
        array.removeFirst();
        System.out.println(array.toString());

        System.out.println(array.contains(new Student().setName("艾AA").setScore(6).setId(6)));
        System.out.println(array.contains(new Student().setName("艾AA").setScore(1).setId(1)));
    }
}
